package com.cheer.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cheer.common.Page;
import com.cheer.common.Result;
import com.cheer.dto.OaChangeHistoryPageDTO;
import com.cheer.service.OaChangeHistoryService;
import com.cheer.vo.OaChangeHistoryListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author chufangzheng
 */
@RestController
@RequestMapping("/change/history")
@Api(tags = "OaChangeHistoryController", description = "合并账户记录表")
public class OaChangeHistoryController {

    @Autowired
    private OaChangeHistoryService oaChangeHistoryService;

    @ApiOperation("查询分页")
    @PostMapping("/page")
    @PreAuthorize("@permissionValidator.isAdmin()")
    public Result<IPage<OaChangeHistoryListVO>> page(@RequestBody OaChangeHistoryPageDTO oaChangeHistoryPageParam) {

        if("0".equals(oaChangeHistoryPageParam.getDepartment())){
            oaChangeHistoryPageParam.setDepartment(null);
        }
        IPage<OaChangeHistoryListVO> page = oaChangeHistoryService.page(oaChangeHistoryPageParam);
        return Result.success(page);
    }


}
